//
//  AddRepairerViewController.m
//  Manage
//
//  Created by 杨康 on 2017/11/23.
//  Copyright © 2017年 杨康. All rights reserved.
//

#import "AddRepairerViewController.h"

@interface AddRepairerViewController ()
@property(nonatomic,strong)ykTableView *tableView;
@end

@implementation AddRepairerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"添加修理商";
    
    UIButton *leftButton=(UIButton *)self.navigationItem.leftBarButtonItem.customView;
    leftButton.selected=YES;
    
    
    
    
    UIView *topView=[[UIView alloc]initWithFrame:CGRectMake(0, TOP_HEIGHT, SCREEN_WIDTH, 120)];
    topView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:topView];
    
    UILabel *photoLab=[SingLeton myLabel:[UIColor color3] andTitle:@"修理商照片" andFont:14.0];
    [topView addSubview:photoLab];
    [photoLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(15);
    }];
    
    for (int i=0; i<3; i++) {
        YKButton *carButton=[SingLeton endButton:[UIColor whiteColor] andTitle:nil RequestSuccess:^(UIButton *btn) {
            [SingLeton PhotoAction:self RequestSuccess:^(UIImagePickerController *picker, NSDictionary<NSString *,id> *info) {
                //选择
                if (info) {
                    UIImage* image = [info objectForKey:@"UIImagePickerControllerEditedImage"];
                    [btn setBackgroundImage:image forState:UIControlStateNormal];
                }
                //取消
                else
                {
                }
            }];
        }];
        [topView addSubview:carButton];
        [carButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(photoLab.mas_left).mas_offset(65*i);
        make.top.mas_equalTo(photoLab.mas_bottom).mas_offset(15);
        make.size.mas_equalTo(CGSizeMake(50, 50));
        }];
        carButton.layer.cornerRadius=0;
        carButton.type=@"yangkang";
        [carButton setBackgroundImage:[UIImage imageNamed:@"添加图片"] forState:UIControlStateNormal];
        
        
        
    }
    
    self.tableView=[SingLeton myTableViewWithFrame:CGRectMake(0, TOP_HEIGHT+140, SCREEN_WIDTH, 400) withRefresh:NO didSelect:^(ykTableView *tableView, NSIndexPath *indexPath) {
        
    }];
    [self.view addSubview:self.tableView];
    
    
    self.tableView.className=@"Type1";
    NSMutableArray *itemArr=[NSMutableArray array];
    
    
    cellData *dataObj=[[cellData alloc]init];
    dataObj.text=@"修理商";
    dataObj.detailText=@"修理商名称";
    
    cellData *dataObj2=[[cellData alloc]init];
    dataObj2.text=@"地址";
    dataObj2.detailText=@"我家在东北松花江上啊我家在东北松花江上啊";
    
    
    
    cellData *dataObj3=[[cellData alloc]init];
    dataObj3.text=@"联系电话";
    dataObj3.detailText=@"13800000000";
    
    cellData *dataObj4=[[cellData alloc]init];
    dataObj4.text=@"评分";
    dataObj4.detailText=@"";
    
    
    
    [itemArr addObject:dataObj];
    [itemArr addObject:dataObj2];
    [itemArr addObject:dataObj3];
    [itemArr addObject:dataObj4];
        
        
        
    
    [self.tableView.dataArray addObject:itemArr];
    [self.tableView reloadData];
    
    self.tableView.tableFooterView=[self customFootView];
    
    
    
}
-(UIView *)customFootView
{
    UIView *footView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 110)];
    
    
    UIButton *saveBtn=[SingLeton endButton:[UIColor colorQ] andTitle:@"保存" RequestSuccess:^(UIButton *btn) {
        
    }];
    [footView addSubview:saveBtn];
    [saveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(20);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-30, 44));
    }];
    
    
    
    return footView;
}


@end
